//package com.example.comm;
//
//import lombok.extern.slf4j.Slf4j;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.config.YamlPropertiesFactoryBean;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
//import org.springframework.core.io.InputStreamResource;
//
//import java.io.FileInputStream;
//import java.io.FileNotFoundException;
//
//@Configuration
//@Slf4j
//public class CommConfigration {
////	private static Logger log = LoggerFactory.getLogger(CommConfigration.class);
//	@Bean
//    public PropertySourcesPlaceholderConfigurer properties() {
//	    System.out.println("=========================");
//        PropertySourcesPlaceholderConfigurer configurer = new PropertySourcesPlaceholderConfigurer();
//        YamlPropertiesFactoryBean yaml = new YamlPropertiesFactoryBean();
//        String userDir = System.getProperty("user.dir");
//        String fs = System.getProperty("file.separator");
//        InputStreamResource ir = null;
//        log.info("first-path==" + userDir + fs + "application-comm.yml");
//        log.info("user.dir============" + System.getProperty("user.dir"));
//        try {
//			FileInputStream fis = new FileInputStream(userDir + fs + "application-comm.yml");
//			ir = new InputStreamResource(fis);
//        } catch (FileNotFoundException e) {
//        	log.error("项目根目录不存在application-comm.yml, 从classpath加载");
//			// 从classpath加载
//			ir = new InputStreamResource(this.getClass().getResourceAsStream("/application-comm.yml"));
//			e.printStackTrace();
//		}
//        yaml.setResources(ir);
//        configurer.setProperties(yaml.getObject());
//        return configurer;
//    }
//}
